Skip to content

Add robust static/dynamic initialization schemes and population initi… - #14

Merged
jcrvz merged 1 commit into
masterfrom
feat/population/initializers
Mar 6, 2026
Merged

jcrvz merged 1 commit into
masterfrom
feat/population/initializers

Conversation

@J0NGS

@J0NGS J0NGS commented Mar 4, 2026

Copy link
Copy Markdown
Collaborator

This commit expands initialization support for static/dynamic hyper-heuristic execution and adds coverage for the new population initialization strategies.

What was done

  • Added validated initial-scheme handling in Hyperheuristic, including compatibility with the legacy typo key (intial_scheme) and normalized scheme parsing.
  • Propagated initial_scheme through static and dynamic solve paths, and through candidate evaluation.
  • Hardened candidate decoding to support NumPy integer types and reject empty encoded sequences with a clear error.
  • Updated dynamic operator application to accept direct operator tuples.
  • Hardened Metaheuristic initialization when search_operators is None or a NumPy array.
  • Extended Population initialization with additional schemes: lhs, sobol, halton, beta, normal, lognormal, exponential, and rayleigh.
  • Kept neural-network-specific flow unchanged in this patch.

Where it was done

  • customhys/hyperheuristic.py
  • customhys/metaheuristic.py
  • customhys/population.py
  • tests/test_population_initialization.py

How it was done

  • Introduced an explicit set of valid schemes and a selector/normalizer method in Hyperheuristic.
  • Passed the selected scheme into Metaheuristic runs used by static/dynamic modes.
  • Added tuple-aware execution logic in Metaheuristic.apply_search_operator.
  • Implemented additional sampling methods in Population, including quasi-random (Sobol/Halton), stratified (LHS), and distribution-based initializers.
  • Added focused tests covering output shape/range/finite values, LHS stratification, Sobol size behavior for non-power-of-two agent counts, distributional bias checks, scheme normalization, and unknown-scheme fallback behavior.

Validation

  • ruff checks passed for modified files.
  • Targeted tests passed:
    • tests/test_population_initialization.py
    • tests/test_metaheuristic.py

@J0NGS
J0NGS requested a review from jcrvz March 4, 2026 17:53
Comment thread customhys/population.py Resolved

@jcrvz jcrvz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition.

@jcrvz
jcrvz merged commit f979a66 into master Mar 6, 2026
10 checks passed
@J0NGS
J0NGS deleted the feat/population/initializers branch May 1, 2026 12:03
@J0NGS J0NGS self-assigned this Jul 25, 2026
@J0NGS J0NGS added the enhancement New feature or request label Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants